package cisdi.mes.sm.rm.web;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import cisdi.mes.sm.rm.service.QualityMgr;

@Controller
public class QualityCtl {

	@Autowired
	private QualityMgr qualityMgr;

	
	public QualityMgr getQualityMgr() {
		return qualityMgr;
	}


	public void setQualityMgr(QualityMgr qualityMgr) {
		this.qualityMgr = qualityMgr;
	}


	//成分决策
	@RequestMapping("/rm/QualityCtl/decideAna")
	@ResponseBody
	public Map<String, Object> decideAna(HttpServletRequest request,@RequestParam("qualityBatch") String qualityBatch) {

		//定义输出
		Map<String, Object> map = new HashMap<String, Object>();
		try {
			map = qualityMgr.decideAna(qualityBatch);
		} catch (Exception e) {
			e.printStackTrace();
			map.put("success", false);
			map.put("message", e.toString());
		}

		return map;
	}
	
	@RequestMapping("rm/QualityCtl/anaInput")
	public ModelAndView anaInput(HttpServletRequest request) {
		// 定义输出
		ModelAndView mav = new ModelAndView();
		// 获取输入
		String view = request.getParameter("view");
		mav.setViewName(view);
		return mav;
	}
}
